package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IMonitorConfigDao;
import org.jsbd.boss.domian.MonitorConfigBean;
import org.springframework.stereotype.Repository;

import edu.hziee.common.dbroute.BaseDAO;

@Repository("monitorConfigDao")
public class MonitorConfigDaoImpl extends BaseDAO implements IMonitorConfigDao {

	@Override
	public void saveMonitorConfig(MonitorConfigBean MonitorConfig) {
		super.insert("qy_channel_monitor_config.insert_qy_channel_monitor_config", MonitorConfig);
	}

	@Override
	public void updateMonitorConfig(MonitorConfigBean MonitorConfig) {
		super.update("qy_channel_monitor_config.update_qy_channel_monitor_config", MonitorConfig);
	}

	@Override
	public void updateMonitorConfigItemValue(MonitorConfigBean MonitorConfig) {
		super.update("qy_channel_monitor_config.update_qy_channel_monitor_config_itemvalue", MonitorConfig);
	}
	
	
	@Override
	public MonitorConfigBean getMonitorConfig(MonitorConfigBean MonitorConfig) {
		return (MonitorConfigBean) super.queryForObject("qy_channel_monitor_config.select_qy_channel_monitor_config_one", MonitorConfig);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<MonitorConfigBean> getMonitorConfigList(MonitorConfigBean MonitorConfig) {
		return super.queryForList("qy_channel_monitor_config.select_qy_channel_monitor_config_list", MonitorConfig);
	}

	@Override
	public Map<String, Object> getMonitorConfigListPage(DataGridModel page, MonitorConfigBean form) {
		form = (form == null ? new MonitorConfigBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("qy_channel_monitor_config.select_qy_channel_monitor_config_page_count", form));
		results.put("rows", super.queryForList("qy_channel_monitor_config.select_qy_channel_monitor_config_list", form));
		return results;
	}

	@Override
	public Integer getMonitorConfigCount(MonitorConfigBean MonitorConfig) {
		return super.queryForCount("qy_channel_monitor_config.select_qy_channel_monitor_config_page_count", MonitorConfig);
	}

	public void deleteMonitorConfig(MonitorConfigBean MonitorConfig){
		super.insert("qy_channel_monitor_config.delete_qy_channel_monitor_config", MonitorConfig);
	}

	@Override
	public void updateItemValue(List<MonitorConfigBean> monitorConfigBeans) {
		super.batchUpdate("qy_channel_monitor_config.update_qy_channel_monitor_config_itemvalue", monitorConfigBeans);
	}

}
